<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>短期外出申请表</title>
    <link rel="stylesheet" href="../static/css/reset.css">
    <link rel="stylesheet" href="../static/plus/eleme.css">
    <link rel="stylesheet" href="../static/css/style_xia.css">
</head>
<body>
<div id="app" class="car-apply apply-leave">
    <mt-header fixed title="短期外出申请表">
        <mt-button slot="left" icon="back" @click="goBack"></mt-button>
        <mt-button slot="right" icon="more" @click="sheetVisible = true;"></mt-button>
    </mt-header>
    <section class="content">
        <div class="item">
            <label class="label" for="">部门</label>
            <input class="text" type="text" v-model="apply.department" disabled>
        </div>
        <div class="item">
            <label class="label" for="">申请人</label>
            <input class="text" type="text" v-model="apply.applicant" disabled>
        </div>
        <div class="item">
            <label class="label" for="">外出开始时间</label>
            <input v-model="apply.startTime" type="text" class="text" @click="open('picker1')">
        </div>
        <div class="item">
            <label class="label" for="">外出结束时间</label>
            <input v-model="apply.endTime" type="text" class="text" @click="open('picker2')" >
        </div>
        <div class="item select-num" @click="showVacateDate = true">
            <label class="label" for="">外出天数</label>
            <input class="text" type="text" v-model="apply.dataNumText">
        </div>
        <div class="item">
            <label class="label" for="">申请时间</label>
            <input class="text" type="text" v-model="apply.applyTime" disabled>
        </div>
        <div class="item reason">
            <label class="label" for="">外出事由</label>
            <textarea name="" id="" rows="5" v-model="apply.reason"></textarea>
        </div>
        <div class="item send-btn">
            <button class="btn" @click="applyBth">提交</button>
        </div>
        <!--开始时间选择器-->
        <mt-datetime-picker
                ref="picker1"
                type="datetime"
                :start-date="startDate"
                @confirm="handleConfirmS">
        </mt-datetime-picker>

        <!--结束时间选择器-->
        <mt-datetime-picker
                ref="picker2"
                type="datetime"
                :start-date="startDate"
                @confirm="handleConfirmE">
        </mt-datetime-picker>

        <!--数量选择器-->
        <div class="custom-picker" v-show="showVacateDate">
            <transition name="btnModel">
                <div class="picker-box">
                    <div class="btns">
                        <button @click="showVacateDate = false">取消</button>
                        <button @click="showVacateDate = false">确认</button>
                    </div>
                    <mt-picker :slots="numberSlot" @change="onNumberChange" :visible-item-count="3"></mt-picker>
                </div>
            </transition>
        </div>

        <!--active sheet-->
        <mt-actionsheet
                :actions="actions"
                v-model="sheetVisible">
        </mt-actionsheet>
    </section>
    <v-footer></v-footer>
    <div class="loading" v-show="isShow">
        <mt-spinner :type="0" :size="60"></mt-spinner>
    </div>
</div>
</body>
<script src="../static/plus/vue.js"></script>
<script src="../static/plus/eleme.js"></script>
<script src="../static/js/common.js"></script>
<script>
    window.onload =function () {
        var vm = new Vue({
            el: '#app',
            data:{
                showVacateDate: false,
                isShow: true,
                actions:[],
                isShowBtnModel:false,
                startDate:new Date(),
                sheetVisible:false,
                modelBtns: [
                    {id: 1, name: '保存'},
                    {id: 2, name: '提交'},
                    {id: 3, name: '终止'},
                    {id: 4, name: '查看流程图'},
                    {id: 5, name: '删除'},
                    {id: 6, name: '完成'}
                ],
                isShowBtnModel: false,
                apply: {
                    department: '综合部', // 部门
                    applicant: '测试', // 申请人
                    applyTime: '2018-02-08 21:12',
                    dataNum: '',
                    dataNumText: '',
                    startTime: '',
                    endTime: '',
                    reason: '原因'
                },
                numberSlot: [
                    {
                        flex: 1,
                        values: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1],
                        className: 'slot1'
                    },
                    {
                        divider: true,
                        content: '（天--时）',
                        className: 'slot2'
                    },
                    {
                        flex: 1,
                        values: [
                            0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1,
                            1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2,
                            2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3
                        ],
                        className: 'slot3'
                    }
                ]
            },
            methods:{
                onNumberChange(picker, values) {
                    var day = values[0];
                    var h = values[1];
                    this.apply.dataNum = day;
                    this.apply.dataNumText = day+"天"+' '+h+"小时";
                },
                handleConfirmS(value) {
                    this.apply.startTime = getDateTime(value);
                },
                handleConfirmE(value) {
                  this.apply.endTime = getDateTime(value);
                },
                open(picker) {
                    this.$refs[picker].open();
                },
                goBack() {
                    history.go(-1);
                },
                applyBth() {

                },
                selectNum() {

                },
                getBtnCode(e) {
                    console.log(e);
                }
            },
            created() {

            },
            mounted() {
                setSectionHeight();
                this.isShow = false;
                this.actions = [
                    {name: '保存', method: this.getBtnCode},
                    {name: '提交', method: this.getBtnCode},
                    {name: '终止', method: this.getBtnCode},
                    {name: '查看流程图', method: this.getBtnCode},
                    {name: '删除', method: this.getBtnCode},
                    {name: '完成', method: this.getBtnCode}
                ]
            }
        });
    }

</script>
</html>